//============================================================================
// Name        : robak_klient.cpp
// Author      : tomaszd
// Version     :
// Copyright   : Copyright Reserved 2008
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include "UdpClient.h"
#include <string.h>

using namespace std;

int main() {
	UdpClient c;
	c.client_config("options.cfg");
	c.submit_player();
	c.connect_to_game();
	

	ClientComunicationStruct c_com_str;
	c_com_str.d = SNAKE_LEFT;
	strcpy(c_com_str.nick, c.client_options.nick);
	//c_com_str.passwd = c.client_options.passwd;
	
	cout << "mapa: " << c.game_map.width << "x" << c.game_map.height << endl;
	int k, i = 1;
	while ( 1 )
	{
		//cout << "podaj kierunek: ";
		//cin >> k;
		c.player_move.round = i;
		c.player_move.direction = k;
		c.send((char*)&c_com_str, sizeof(c_com_str));
		//c.receive((char*)&c.players_moves, sizeof(moves));
		cout << "round: " << c.players_moves.round << endl;
		i++;
		sleep(1);
	}

	cout << "git" << endl; // prints git
	return 0;
}
